using System;
using System.Collections.Generic;
using System.Text;

namespace Prologis.ShifterNT {


    public class FieldList : GenericList<Field>, ICloneable {

        
        public FieldList() {
            Key = new GenericList<Field>();
            Source = new FieldSourceList();
        }


    
        public GenericList<Field> Key;


        
        public FieldSourceList Source;
            

    
        public bool HasStrongNames = true;



        public bool HasValues = false;
              

        
        public new int Add(Field field) {
            int count = base.Add(field);
            //if (field.IsKey) {
            //    Key.Add(field);
            //}
            Source.Add(field.Source, field);
            return count;
        }


        
        public new object Clone() {
            FieldList list = new FieldList();
            foreach(Field field in this) {
                list.Add( (Field) field.Clone());
            }
            list.HasStrongNames = HasStrongNames;
            list.Key = (GenericList<Field>)Key.Clone();
            list.Source = (FieldSourceList) Source.Clone();
            return list; 
        }


        public override string ToString() {

            StringBuilder sb = new StringBuilder();

            sb.Append("\r\n");

            foreach (Field field in this) {
                sb.Append(field.ToString());
                sb.Append("\r\n");
            }
            return sb.ToString();
        }

    }
}
